import * as actionTypes from './actionType';

export default (state = {}, action) => {
    switch (action.type) {
        case actionTypes.TODAYWARING:
            return {
               ...state,todayWarning:action.todayWarning,
            }
        case actionTypes.WARININGPROPORTION:
            return {
                ...state,regionProportion:action.regionProportion,
            }
        case actionTypes.WARININGSTATISTICS:
            return {
                ...state,alarmStatistics:action.alarmStatistics,
            }
        case actionTypes.LATESTENWARING:
            return {
                ...state, latestTenWarning:action.latestTenWarning,
            }
        case actionTypes.MONTHWARNING:
            return {
                ...state, monthWarning:action.monthWarning,
            }
        case actionTypes.LOGOUT: {
            return {
                ...state, isLogin: false
            }
        }
        case actionTypes.ALLDATA:     //  所有告警信息和摄像头信息
            return {
                ...state, 
                todayWarning:action.todayWarning,
                regionProportion:action.regionProportion,
                alarmStatistics:action.alarmStatistics,
                latestTenWarning:action.latestTenWarning,
                monthWarning:action.monthWarning,
                cameraList:action.payload
            }
        default:
            return state
    }
}